Mapping


Problem 1
Repeat the problem in: Neural Lab > Mapping > Sine and Cosine using probabilistic neural networks (PNN). Create a New Project called SinCosProb. As the training set and validation set were already created, just copy the files: trainSetInput.csv, trainSetTarget.csv, validSetInput.csv and validSetTarget.csv to a new folder for this problem.

SinCosProb\Train.lab
Matrix trainSetInput;
Matrix trainSetTarget;
trainSetInput.Load();
trainSetTarget.Load();
ProbNet net;
net.TrainConjGrad(trainSetInput, trainSetTarget, 1000, 0.00001);
net.Save();

SinCosProb\CheckTraining.lab
//_________________________________________ Load the training set
Matrix trainSetInput;
trainSetInput.Load();
Matrix trainSetTarget;
trainSetTarget.Load();
//_________________________________________ Load the ANN
ProbNet net;
net.Load();
//_________________________________________ Run
Matrix output = net.Run(trainSetInput, trainSetTarget, trainSetInput);
double mse = ComputeMse(output, trainSetTarget);
//_________________________________________ Relative Error
Vector error = ComputeRelError(output, trainSetTarget);
XyChart checkTraining;
checkTraining.SetCaption("case", false, "Relative Error", false);
checkTraining.AddGraphY(error, "Relative Error", 2, 1, 0, 255, 0);
checkTraining.SetLogScale(false, true);
checkTraining.SetLimits(0, trainSetTarget.GetRowCount(), 1.0e-5, 1.0);
checkTraining.SetColorMode(2);
checkTraining.SaveAndShow();
checkTraining.SavePDF(0.0);
checkTraining.SaveEMF();

CheckTraining

SinCosProb\Validation.lab
//_________________________________________ Load the training set
Matrix trainSetInput;
trainSetInput.Load();
Matrix trainSetTarget;
trainSetTarget.Load();
//_________________________________________ Load the validation set
Matrix validSetInput;
validSetInput.Load();
Matrix validSetTarget;
validSetTarget.Load();
//_________________________________________ Load the ANN
ProbNet net;
net.Load();
//_________________________________________ Run
Matrix output = net.Run(trainSetInput, trainSetTarget, validSetInput);
double mse = ComputeMse(output, validSetTarget);
//_________________________________________ Relative Error
Vector error = ComputeRelError(output, validSetTarget);
XyChart validation;
validation.SetCaption("case", false, "Relative Error", false);
validation.AddGraphY(error, "Relative Error", 2, 1, 0, 255, 0);
validation.SetLogScale(false, true);
validation.SetLimits(0, validSetTarget.GetRowCount(), 1.0e-5, 1.0);
validation.SetColorMode(2);
validation.SaveAndShow();
validation.SavePDF(0.0);
validation.SaveEMF();

Validation

Problem 2
Compare the validation performance of the PNN with the validation performance of the ANN previously trained. (a) Plot the mse for case for the validation set for the ANN in the problem Neural Lab > Mapping > Sine and Cosine . (b) Plot the mse for case for the validation set for the PNN in problem 1.

AnnError

PnnError

© Copyright 2000-2021 Wintempla selo. All Rights Reserved. Jul 22 2021. Home